<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="app">
    <input type="button" value="重置message" @click="setMsg">
    <input type="text" v-model="message" @keyup.enter="getMsg">
    <p>{{message}}</p>
</div>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script>
    var app = new Vue({
        el:'#app',
        data:{
            message:"自信者天助"
        },
        methods:{
            setMsg:function () {
                this.message="自信才有未来";
            },
            getMsg:function () {
                alert(this.message);
            }
        }
    })

</script>
</body>
</html>